package cn.js.sangu.unitStore.mapper;

import cn.js.sangu.unitStore.entity.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 拥有框架的方法
 */
//@Mapper
public interface UserMapper extends BaseMapper<User> {


    @Select("SELECT name FROM user")
    List<String> getAllUsernames();

//    @Insert("insert into `user` (username,password,name,phone,email,address,avatar,role) " +
//            "values (#{username},#{password},#{name},#{phone},#{email},#{address},#{avatar},#{role})")
//    void sava(User user);
//
//    @Update("update `user` set username=#{username},password=#{password},name=#{name}," +
//            "phone=#{phone},email=#{email},address=#{address},avatar=#{avatar} where id=#{id}")
//    void update(User user);
//
//    @Delete("delete from `user` where id=#{id}")
//    void delete(Integer id);
//
//    @Select("select * from `user` order by id desc")
//    List<User> findAll();
//
//    @Select("select * from `user` where id = #{id}")
//    User findById(Integer id);
//
//    @Select("select * from `user` where name = #{name} order by id desc")
//    List<User> findByName(String name);
//
//    @Select("select * from `user` where username = #{username} order by id desc")
//    List<User> findByUserName(String username);
//
//    @Select("select * from `user` where name like concat('%',#{name},'%') order by id desc")
//    List<User> findByParam(String name);
//
//    @Select("select * from `user` where name like concat('%',#{name},'%')  order by id desc limit #{skipNum},#{pageSize}")
//    List<User> findByPage(@Param("name") String name,@Param("skipNum") Integer skipNum, @Param("pageSize") Integer pageSize);
//
//    @Select("select count(id) from `user` where name like concat('%',#{name},'%')  order by id desc")
//    Integer findCountByPage(@Param("name") String name);
}
